package saeildamil.ch18.communication;

import javax.swing.JOptionPane;

public class PrintPiThread extends Thread {
	SharedArea sharedArea;

	public PrintPiThread(SharedArea sharedArea) {
		this.sharedArea = sharedArea;
	}
	
	@Override
	public void run() {
		if(sharedArea.isReady != true){
			synchronized (sharedArea) {
				try {
					JOptionPane.showMessageDialog(null, "대기");
					sharedArea.wait();
				} catch (InterruptedException e) {
					System.out.println(e.getMessage());
				}	
			}
		}
		JOptionPane.showMessageDialog(null, sharedArea.result);
	}
}
